<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Limits the number of results returned</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongocursor.key.html">« MongoCursor::key</a></li>
      <li style="float: right;"><a href="mongocursor.maxtimems.html">MongoCursor::maxTimeMS »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongocursor.html">MongoCursor</a></li>
    <li>Limits the number of results returned</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongocursor.limit" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoCursor::limit</h1>
  <p class="verinfo">(PECL mongo &gt;=0.9.0)</p><p class="refpurpose"><span class="refname">MongoCursor::limit</span> &mdash; <span class="dc-title">Limits the number of results returned</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongocursor.limit-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>MongoCursor::limit</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$num</code></span>): <span class="type"><a href="class.mongocursor.html" class="type MongoCursor">MongoCursor</a></span></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongocursor.limit-parameters">
  <h3 class="title">Parameters</h3>  
  <p class="para">
   <dl>

    
     <dt>

      <code class="parameter">num</code>
     </dt>

     <dd>

      <p class="para">
       The number of results to return.
      </p>
     </dd>

       
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongocursor.limit-returnvalues">
  <h3 class="title">Return Values</h3>  
  <p class="para">
   Returns this cursor.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-mongocursor.limit-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Throws <a href="class.mongocursorexception.html" class="classname">MongoCursorException</a> if this cursor has started iterating.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongocursor.limit-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member">MongoDB core docs on <a href="https://docs.mongodb.com/manual/reference/method/cursor.limit/" class="link external">&raquo;&nbsp;limit</a>.</li>
    <li class="member"><span class="function"><a href="mongocursor.batchsize.html" class="function" rel="rdfs-seeAlso">MongoCursor::batchSize()</a> - Limits the number of elements returned in one batch</span></li>
    <li class="member"><span class="methodname"><a href="mongocursor.skip.html" class="methodname" rel="rdfs-seeAlso">MongoCursor::skip()</a> - Skips a number of results</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>